package com.mcptt.config.body.info.mcvideo;

import java.io.UnsupportedEncodingException;

public class InfoBodyPublishMcvideo {

	private String mcvideoId = "";
	private String accessToken = null;
	private String clientId = "";
	
	public InfoBodyPublishMcvideo(String mcvideoId, String accessToken, String clientId)
	{
		this.mcvideoId = mcvideoId;
		this.accessToken = accessToken;
		this.clientId = clientId;
	}
	
	public InfoBodyPublishMcvideo(String mcvideoId, String clientId)
	{
		this.mcvideoId = mcvideoId;
//		this.accessToken = accessToken;
		this.clientId = clientId;
	}
	
	public String toString()
	{
		StringBuffer strBuff = new StringBuffer();
		strBuff.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").append("\r\n");
		strBuff.append("<mcvideoinfo xmlns:mgktp=\"urn:3gpp:ns:mcpttGKTP:1.0\" xmlns=\"urn:3gpp:ns:mcvideoInfo:1.0\">").append("\r\n");
		strBuff.append("<mcvideo-Params>").append("\r\n");
		strBuff.append("<mcvideo-request-uri type=\"Normal\">").append("\r\n");
		strBuff.append("<mcvideoURI>").append(mcvideoId).append("</mcvideoURI>").append("\r\n");
		strBuff.append("</mcvideo-request-uri>").append("\r\n");
		strBuff.append("<mcvideo-access-token type=\"Normal\">").append("\r\n");
		if(accessToken != null)
		{
			strBuff.append("<mcvideoString>").append(accessToken).append("</mcvideoString>").append("\r\n");
		}
		else
		{
			strBuff.append("<mcvideoString>").append(mcvideoId).append("</mcvideoString>").append("\r\n");
		}
		strBuff.append("</mcvideo-access-token>").append("\r\n");
		strBuff.append("<mc-org>CRSC_MCX_GPH</mc-org>").append("\r\n");
		strBuff.append("<mcvideo-client-id type=\"Normal\">").append("\r\n");
		strBuff.append("<mcvideoString>").append(clientId).append("</mcvideoString>").append("\r\n");
		strBuff.append("</mcvideo-client-id>").append("\r\n");
		strBuff.append("</mcvideo-Params>").append("\r\n");
		strBuff.append("</mcvideoinfo>");
		
		try {
			return new String(strBuff.toString().getBytes(),"UTF-8");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return strBuff.toString();
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}